import Vue from 'vue'
import './app.less'
import { createAxios } from './request'

import HipsI18n from '@hips/plugin-vue-i18n'
import { AppDsx } from '@hips/plugin-dataset-vuex'

import Feida from '@feida/core'
import Render from '@feida/plugin-taro-render'
import Jssdk from '@hipsfe/plugin-taro-jssdk'

Feida.use(Render)
Feida.use(Jssdk)
const FeidaPlugin = new Feida()
const fetch = FeidaPlugin.createFetch(createAxios())

const App = {
  onShow(options) {},
  render(h) {
    // this.$slots.default 是将要会渲染的页面
    return h('block', this.$slots.default)
  }
}

Vue.use(HipsI18n, {
  defaultLocale: 'zh',
  initialedCallback(name, data) {
    App[name] = data
  }
})
Vue.use(AppDsx, { axios: fetch })
Vue.use(FeidaPlugin, {
  localStoragePre: process.env.TARO_LOCALSTORAGE_PRE
})

export default App
